﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TurboTemplate
{
    public partial class NewListDialog : Form
    {
        public string ListName
        {
            get
            {
                return tbListName.Text;
            }
        }

        public NewListDialog()
        {
            InitializeComponent();
        }

        public NewListDialog(string listName) : this()
        {
            tbListName.Text = listName;
        }

        private void NewListDialog_Load(object sender, EventArgs e)
        {
            tbListName.Focus();
            UpdateUI();
        }

        private void tbListName_TextChanged(object sender, EventArgs e)
        {
            UpdateUI();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }

        private void UpdateUI()
        {
            btnOK.Enabled = tbListName.TextLength > 0;
        }
    }
}
